home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_etladder.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  172 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SHS_ETladder.cog      Make the entry tower ladder open/close.  
  4. #
  5. # [JWC, SXC]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13. message activated
  14. message    startup
  15.  
  16. surface    climable                      # set to climable in marcus
  17.  
  18. sector  doorsector0
  19. sector     doorsector1
  20.  
  21. sound    laddermove=shs_ladder_creak_c.wav        local
  22. sound    ladderstop=shs_ladderroll_stop.wav        local
  23. sound    ladderfall=shs_ladder_moving.wav        local
  24.  
  25. thing    ladder              
  26. thing   button       
  27. thing    player            local
  28. thing    interpcam
  29.  
  30. int      filter=0         local        # prevent multiple activates    
  31. int        position=0        local        # ladder position
  32. int        counter=0        local        # track first time        
  33.  
  34. cog        NoWorkTalkcog
  35.  
  36. end
  37.  
  38. # ========================================================================================
  39.  
  40. code
  41.  
  42.  
  43. startup:
  44.    
  45.     # turn off sector
  46.     SetSectorAdjoins(doorsector0, 0);
  47.     SetSectorAdjoins(doorsector1, 0);
  48.  
  49.     player= GetLocalPlayerThing();
  50.     return;
  51.  
  52. activated:
  53.    
  54.     if (GetCurItem(player) != 0) return; # prevents activating with chalk
  55.  
  56.     if ((GetSenderRef() == button) && (filter == 0))
  57.     {
  58.         
  59.         filter=1;
  60.         StartCutscene(0);
  61.         SetActorFlags(player, 0x200000);
  62.         StopThing(player);
  63.         DeselectWeapon(player);
  64.         DeselectWeaponWait(player);
  65.         
  66.         SetExtCamOffsetToThing(interpCam);
  67.         
  68.         # allow cam to set
  69.         Sleep (.5);
  70.         PlayMode(player, 60, 0);
  71.         
  72.         # synch with button
  73.         Sleep(.3);
  74.                        
  75.         # button goes in
  76.         MoveToFrame(button, 1, 1);
  77.         WaitForStop(button);
  78.            
  79.         # check if powered
  80.         if (global3 == 1)
  81.         {
  82.             
  83.             # ladder position
  84.             position = 1 - position;    # weird but it works
  85.  
  86.             call laddermove;
  87.         }
  88.         else
  89.         {
  90.             # first time thru
  91.             if (counter == 0)
  92.             {
  93.                 # draw 
  94.                 SetSectorAdjoins(doorsector0, 1);
  95.                 SetSectorAdjoins(doorsector1, 1);
  96.                 
  97.                 Rotate(ladder, 90, 2, .75);    # opens ladder quickly
  98.                 PlaySoundLocal(ladderfall, 1.0, 0, 0x0000, 0);
  99.                 WaitForStop(ladder);
  100.                 
  101.                 # make adjoin no move and therefore climable 
  102.                 ClearAdjoinFlags(climable, 0x2);
  103.  
  104.                 counter=1;
  105.                 position=1;    #sets ladder to open
  106.             }
  107.             else
  108.             {
  109.                 # Call NoWorkTalkCog
  110.                 Sleep(.3);
  111.                 SendMessageEx(NoWorkTalkCog, user1, 0, 0, 0, 0);
  112.                 global15 = 0; # per Randy
  113.                 while (global15 == 0)
  114.                 {
  115.                     Sleep(0.01); # wait for line to finish
  116.                 }
  117.             }
  118.         }
  119.         # button comes out
  120.         MoveToFrame(button, 0, 1);
  121.         WaitForStop(button);
  122.     
  123.         RestoreExtCam();
  124.         ClearActorFlags(player, 0x200000);
  125.         EndCutscene();
  126.         filter=0;
  127.     }
  128.     return;
  129.     
  130. laddermove:
  131.  
  132.     # open and close ladder
  133.     
  134.     if (position == 1)    # closed
  135.     {
  136.         # draw 
  137.         SetSectorAdjoins(doorsector0, 1);
  138.         SetSectorAdjoins(doorsector1, 1);
  139.         
  140.         # open ladder
  141.         rotate(ladder, 90, 2, 1.5);
  142.         PlaySoundLocal(laddermove, 1.0, 0, 0x0000, 0);
  143.         WaitForStop(ladder);
  144.         PlaySoundLocal(ladderstop, 1.0, 0, 0x0000, 0);
  145.  
  146.         # make adjoin no move 
  147.         ClearAdjoinFlags(climable, 0x2);
  148.     }
  149.         
  150.     If (position == 0)     # open
  151.     {
  152.         # close ladder
  153.         rotate(ladder, -90, 2, 1.5);
  154.         PlaySoundLocal(laddermove, 1.0, 0, 0x0000, 0);
  155.         WaitForStop(ladder);
  156.         PlaySoundLocal(ladderstop, 1.0, 0, 0x0000, 0);
  157.  
  158.         # make move and therefore not climable
  159.         SetAdjoinFlags(climable, 0x2);
  160.         
  161.         # no draw
  162.         SetSectorAdjoins(doorsector0, 0);
  163.         SetSectorAdjoins(doorsector1, 0);
  164.     }
  165.     
  166.     return;
  167.  
  168.  
  169.  
  170. end
  171.  
  172.